﻿<UserControl x:Class="InseSoft.Views.Controls.CatalogSearch"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:viewModels="clr-namespace:InseSoft.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="10">
        <Grid d:DataContext="{d:DesignInstance {x:Type viewModels:CatalogSearchViewModel}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <DockPanel Margin="3" LastChildFill="True">
                <TextBlock VerticalAlignment="Center" Margin="3">Filtro: </TextBlock>
                <TextBox Margin="0,0,3,0" HorizontalAlignment="Stretch" MaxLength="30" Text="{Binding SearchPattern, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </DockPanel>
            <ListBox 
                    Grid.Row="1" 
                    Margin="6" 
                    ItemsSource="{Binding FilteredList}" 
                    SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" AlternationCount="1">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <DockPanel LastChildFill="True">
                            <TextBlock Text="{Binding Id, Mode=TwoWay}" Width="45" />
                            <TextBlock Text="{Binding Nombre, Mode=TwoWay}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
                        </DockPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>       
    </Border>
</UserControl>
